import { createRouter, createWebHashHistory } from 'vue-router'
import modules from "@/views";

const routes = []

for (let key in modules) {
  let {name, path} = modules[key];
  if (!routes.length) {
    routes.push({
      path: '/',
      redirect: path
    })
  }
  routes.push({
    path,
    name,
    component: () => import(`@/views/${key}`)
  })
}

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
